package il.ac.tau.cg.ex5.rendering;

import il.ac.tau.cg.ex5.util.Vertex;

import javax.media.opengl.GL2;

public abstract class Renderer implements IRenderer
{
	@Override
	public void render(GL2 gl, Vertex translation, float scale, float rotation)
	{
		renderRoom(gl);
		
		gl.glPushMatrix();
		
		gl.glRotatef(rotation, 1.0f, 0.0f, 0.0f);
		gl.glRotatef(rotation, 0.0f, 1.0f, 0.0f);
		gl.glRotatef(rotation, 0.0f, 0.0f, 1.0f);
		gl.glScalef(scale, scale, scale);
		gl.glTranslatef(translation.x, translation.y, translation.z);
		
		renderObj(gl);
		
		gl.glPopMatrix();
	}
	
	@Override
	public void init(GL2 gl)
	{
		
	}
	
	protected abstract void renderRoom(GL2 gl);
	protected abstract void renderObj(GL2 gl);
}
